using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;


namespace RemotingServer
{
    public class MyServer : MarshalByRefObject, RemotingInterface.IServer
    {
        private int i;
        private Random rnd;

        public MyServer()
        {
            i = 0;
            rnd = new Random();
        }

        public RemotingInterface.ComplexObject doSomething(String stringParam, int intParam, double doubleParam, string[] arrayParam)
        {
            lock (rnd)
            {
                RemotingInterface.ComplexObject obj = new RemotingInterface.ComplexObject();
                obj.stringParam = stringParam;
                obj.intParam = ++i;
                obj.doubleParam = doubleParam;

                Thread.Sleep(rnd.Next(0, 50));
                return obj;
            }
        }

    }


}
